load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS")

cc_library(
    name = "render-test-lib",
    hdrs = [
        "include/mbgl/render_test.hpp",
    ],
    includes = [
        "include",
    ],
    visibility = [
        "//platform/default:__pkg__",
        "//render-test/ios:__pkg__",
    ],
)

cc_library(
    name = "render-test-srcs",
    srcs = glob(
        [
            "*.cpp",
            "*.hpp",
        ],
    ) + [
        "include/mbgl/render_test.hpp",
    ],
    copts = CPP_FLAGS + MAPLIBRE_FLAGS,
    includes = [
        "include",
    ],
    visibility = [
        "//render-test/ios:__pkg__",
    ],
    deps = [
        "//expression-test:test_runner_common",
        "//vendor:args",
    ] + select({
        "@platforms//os:ios": ["//platform:ios-sdk"],
        "@platforms//os:linux": ["//platform/linux:impl"],
        "//conditions:default": [],
    }),
)

cc_test(
    name = "render-test",
    timeout = "long",
    args = [
        "--manifestPath",
        "metrics/linux-opengl.json",
    ],
    data = [
        "//metrics:render-test-files",
    ],
    tags = ["no-sandbox"],
    deps = [
        "render-test-srcs",
        "//platform/default:render-test-bin",
        "//vendor:maplibre-native-base",
    ],
)
